home *** CD-ROM | disk | FTP | other *** search
/ Power Tools for Macintosh / Power Tools for Macintosh (SoftBit)(1992).iso / Applications / Alpha 4.01 / ACMDS / Delay.c < prev    next >
C/C++ Source or Header  |  1990-08-15  |  3KB  |  104 lines

  1. /****************************************************************
  2. *                                                               *
  3. * Delay - pause for a second                                    *
  4. *                                                               *
  5. * Copyright © 1990 Karl J. Smith. All Rights Reserved           *
  6. *                                                               *
  7. * email: ksmith@jarthur.claremont.edu                           *
  8. *                                                               *
  9. * 8/15/90                                                       *
  10. *                                                               *
  11. * When debugging, set the project type to application,          *
  12. * and add the ANSI project.                                     *
  13. *                                                               *
  14. * When all your bugs are out, 'undef' DEBUG, set the project    *
  15. * type to Code Resource, with type = ACMD, name = <the name     *
  16. * of the function>, file type to 'AEXT', and the purgeable      *
  17. * flag set to true.                                             *
  18. *                                                               *
  19. * Also, you need to remove the ANSI project from the ACMD       *
  20. * project and replace it with the ANSI-A4 project if you use    *
  21. * any functions in ANSI, such as strlen.                        *
  22. *                                                               *
  23. * If you are not using THINK C, I'm not quite sure what you     *
  24. * should do. :-)                                                *
  25. *                                                               *
  26. ****************************************************************/
  27.  
  28. #undef    DEBUG
  29.  
  30. #include <stdio.h>
  31. #include <string.h>
  32.  
  33. /* Prototypes */
  34. char *
  35. #ifdef    DEBUG
  36. dummy(char *inStr);
  37. #else    DEBUG
  38. main(char *inStr);
  39. #endif    DEBUG
  40.  
  41. char *
  42. #ifdef    DEBUG
  43. dummy(inStr)
  44. #else    DEBUG
  45. main(inStr)
  46. #endif    DEBUG
  47. char    *inStr;
  48. {
  49. #define NUM_TICKS 60L            /* Number of ticks to delay */
  50.     long int finalTicks;        /* Total ticks since boot */
  51.  
  52.     Delay(NUM_TICKS, &finalTicks);
  53.     
  54.     return(inStr);
  55. }
  56.  
  57.  
  58. #ifdef    DEBUG
  59.  
  60. char * ConvertRtoN(char *theStr);
  61.  
  62. char * ConvertRtoN(theStr)
  63.     char *theStr;
  64. {
  65.     char *currentChar;
  66.     
  67.     for (currentChar = theStr;*currentChar != 0; currentChar++)
  68.         if (*currentChar == '\r')
  69.             *currentChar = '\n';
  70. }
  71.     
  72. main()
  73. {
  74.     char    *str = "Boing\rMonkey\r\n\t\v\b\f\a\\\'\"";
  75.     char    *ret;
  76.     char    *once;
  77.     char    *currentChar;
  78.         
  79.     once = NewPtr(256L);
  80.     
  81.     strcpy(once, str);                
  82.     
  83.     ret = dummy(once);
  84.     
  85.     ConvertRtoN(ret);                /* Convert '\r' to '\n' so we can see them in a printf */
  86.     ConvertRtoN(str);
  87.         
  88.     printf("The original is:\n\n%s", str);
  89.     printf("\n----\n\nThe result is:\n\n");
  90.     
  91.     for(currentChar = ret;*currentChar != 0;currentChar++)
  92.         {
  93.             printf("%c", *currentChar);
  94.         }
  95.     
  96. }
  97. #endif    DEBUG
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.